#ifndef MYGRAPHICSSCENE_H
#define MYGRAPHICSSCENE_H

#include <QGraphicsScene>
#include <QDebug>
#include <QGraphicsSceneDragDropEvent>
#include <QMimeData>
#include <QGraphicsLineItem>
#include <QTransform>

#include "mygraphicsitem.h"

class MyGraphicsScene : public QGraphicsScene
{
    Q_OBJECT
public:
    explicit MyGraphicsScene(QObject *parent = 0);
    void setScaleStep(qreal step);
    qreal scaleStep(void);

    qint64 totalTime(void) const;

    void addType(QString str);
    QStringList typeList() const;

    
signals:
    void mousePressed(MyGraphicsItem*);
    
public slots:
    void scaleIn(void);
    void scaleOut(void);
    void tick(qint64 time);
    void setTotalTime(quint64 time);

protected:
    virtual void drawBackground(QPainter *painter, const QRectF &rect);

    void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
    void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
        //zkontrolovat nastaveni y podle typu
    void dropEvent(QGraphicsSceneDragDropEvent *event);

    void mousePressEvent(QGraphicsSceneMouseEvent *event);

    void scaleUpdate(void);

    void updateSceneRectSize();

private:
    QGraphicsLineItem *_line;
    qreal _scaleStep;
    qreal _scale;
    qint64 _totalTime;
    qint64 _scaledTotalTime;
    QStringList _typesList;
    qint64 _aktualTime;
    qint64 _scaledAktualTime;
};

#endif // MYGRAPHICSSCENE_H
